package com.kuangstudy.common.demo6;

/**
 * ClassName: Demo4
 * date: 2021/07/14 16:40:19
 *
 * @author zlk
 */
public class Demo4 {
    public static void main(String[] args) {
        String str = "this is a text";
        String[] s = str.split(" ");
        for (String s1 : s) {
            System.out.println(s1);
        }
        String replace = str.replace("text", "practice");
        System.out.println(replace);
        String replace1 = str.replace("text", "easy text");
        System.out.println(replace1);
        for (int i = 0; i < s.length; i++) {
            char first = s[i].charAt(0);
            /*把第一个字符转化为大写*/
            char toUpperCase = Character.toUpperCase(first);//Character
            String s1 = toUpperCase + s[i].substring(1);
            System.out.println(s1);
        }
    }
}
